﻿namespace Okazuki.BehaviorSupport.Design.Commons
{
    using System;

    public static class TypeBuilder
    {
        public static object CreateBehavior(Type behaviorType)
        {
            return behaviorType.GetConstructor(Type.EmptyTypes).Invoke(null);
        }

        public static object CreateTriggerAction(Type triggerType, Type actionType)
        {
            dynamic trigger = triggerType.GetConstructor(Type.EmptyTypes).Invoke(null);
            dynamic action = actionType.GetConstructor(Type.EmptyTypes).Invoke(null);
            trigger.Actions.Add(action);
            return trigger;
        }
    }
}
